<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="uct" uri="/WEB-INF/uct.tld" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <%@ include file="/common/sale/include/common-base.jsp"%>
	<script src="${ctx}/js/jquery-tools.min.js"></script>
	<script src="${ctx}/js/funds.js"></script>
  <title>客户签约查询 | ${titleName}</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
</head>
<body class="hold-transition ${sysColor} sidebar-mini">
<div class="wrapper">

  <!-- top start -->
  <%@include file="/common/sale/top.jsp" %>
  <!-- top end -->
  <!-- left start -->
  <%@include file="/common/sale/left.jsp" %>
  <!-- left end-->

  <div class="content-wrapper">
   <!-- 
		<ol class="breadcrumb bgblue">
			<li>
				<span class="label label-danger font14" >结算管理 / 虚拟签约账户</span>
			</li>
		</ol>
	 -->	
    <!-- Main start -->

	<section class="content">
      <div class="row">
        <div class="col-xs-12">
          
           <!------搜索  start ------->
          <div class="box box-info">
             <!--搜索title  start --> 
	          <div class="box-header with-border">
                 <h3 class="box-title"><i class="fa fa-search"></i> 虚拟签约账户搜索</h3>
                 <div class="box-tools pull-right">
	                <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
	                </button>
                 </div>
              </div>
            <!--搜索title  end --> 
            <div class="box-body">
			  <form id="searchFrom" class="form-horizontal">
					<input type="hidden" name="userStatus" value="1"/>
					<input type="hidden" name="doCode" value="F009"/>
					<input type="hidden" name="source" value="manager"/>
					<input type="hidden" name="orderBy" value="create_time desc" />
				<div class="form-group">
					<label class="col-sm-2 control-label" >资金账号：</label>
					<div class="col-sm-3">
						 <input type="text" class="form-control clean" name="userName" value="" /> 
					</div>
					<label class="col-sm-2 control-label" >客户名称：</label>
					<div class="col-sm-3">
						 <input type="text" class="form-control clean"  name="realName" value="" />
					</div>
                   
				</div>
				<center>
				   <div class="box-footer clearfix">
				      <button type="button" class="btn btn-success" onclick="getTableData();"><i class="fa fa-search"></i>查询</button>
					  <button  type="reset" class="btn btn-warning" >重置 </button>
				   </div>
				</center>
			  </form>
            </div>
	     </div>
	     <!------- 搜索 end -------->
            
         <!------- 列表 start -------->
	      <div class="box box-success">
            <!--列表title  start --> 
	          <div class="box-header with-border">
                 <h3 class="box-title"><i class="fa fa-user"></i> 虚拟签约账户列表 
                 </h3>
                 <div class="box-tools pull-right">
	                 　　　　　　　　<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
	                </button>
                 </div>
              </div>
            <!--列表title  end --> 
              <div class="box-body">
	             <table id="example" class="table table-bordered table-hover" >
                    <thead>
                    <tr>
                      <th>序号</th>
                      <th>客户资金账号</th>
                      <th>客户名称</th>
                      <th>证件类型</th>
                      <th>证件号码</th>
                      <th>登录账号</th>
                      <th>创建日期</th>
                      <th>操作</th>
                    </tr>
                    </thead>
                    <tbody id="myList">
                    </tbody>
                 </table>
              
         	    <center>
    	  			  <ul id="pageList"></ul>
        		</center>
            </div>
           </div>
	     <!------- 列表 end -------->    
        </div>
      </div>
    
  
  
	<div win-title="查看窗口" class="modal fade" id="my_modal" tabindex="-2" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog" style="width:600px;top:100px;">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
						&times;
					</button>
					<h4 class="modal-title">
						<font color="red">查看余额</font>&nbsp;
					</h4>
				</div>
				<div class="modal-body">
					<form class="form-horizontal" role="form" id="viewForm">
						<div class="box-body">
						  <!-- Custom Tabs -->
							<div class="form-group">
								<span class="col-sm-3 tar" >客户资金账号：</span>
								<span class="col-sm-8"  id="fundsUserName"></span>
							</div>
							<div class="form-group">
								<span class="col-sm-3 tar" >客户名称：</span>
								<span class="col-sm-8" id="fundsRealName"></span>
							</div>
							<div class="form-group tac">
								<label class="col-sm-4 f16 fx1">￥<span id="fundsAmtTotal"></span></label>
								<label class="col-sm-4 f16 fx3">￥<span id="fundsM1"></span></label>
								<label class="col-sm-4 f16 fx5">￥<span id="fundsM2"></span></label>
							</div>
							<div class="form-group tac">
								<span class="col-sm-4" >总金额</span>
								<span class="col-sm-4" >可用金额</span>
								<span class="col-sm-4" >冻结金额</span>
							</div>
						  <!-- nav-tabs-custom -->
						</div>
					</form>
					<div class="box-body" style="background-color:#F0F0F0">
						<form id="myForm2" name="myForm2" >
							<input type="hidden" id="customerNo" name="customerNo" />
							<input type="hidden" id="settleAccountNo" name="settleAccountNo" /><br/>
							<input type="radio" id="direction_in" name="direction" value="in" checked="true"/>充值 &nbsp; &nbsp;
							<input type="radio" id="direction_out" name="direction" value="out"/>提现  
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							操作金额：<span><input type="text" class="form-control clean" style="width: 30%;" id="amount" name="amount" size="10" maxlength="9"/>元  </span> &nbsp;&nbsp; 
							<input type="button" value=" 提 交 " class="btn btn-danger" style="width: 100px;" onclick="checkSubmitInfo()"/>
						</form>
					</div>
					<div class="box-footer">
						<button type="button" class="btn btn-success pull-right" onclick="cannel();">关闭</button>
					</div>
				</div>
			</div>
			<!-- /.modal-content -->
	</div>		
	</div>
  <!-- /.content-wrapper -->
  
  	
<script type="text/template" id="dataList">
	<?for ( var i = 0; i < rows.length; i++) {?>
		<tr>
			<td class="text-center"><?=(pageObj.currentPage-1)*10+(i+1)?></td>
			<td style="display:none;"><?=rows[i].userId?></td>
			<td><?=rows[i].userName?></td>
			<td><?=rows[i].realName?></td>
			<td><?=strUtil.doNull(rows[i].certiType,'')?></td>
			<td><?=strUtil.doNull(rows[i].certiFicate,'')?></td>
			<td><?=rows[i].createUser?></td>
			<td><?=rows[i].createTime?></td>
			<td>
				<button class="btn btn-success btn-xs" onclick="openViewWin('<?=rows[i].userName?>','<?=rows[i].realName?>')"><i class="fa fa-search"></i> 查看/充值</button>
			</td>
		</tr>
	<?}?>
</script>

<script>
var clickMenu= 'funds-user-list';
var id;
$(function () {
	getTableData();
	//设置模态框隐藏事件钩子  
	$( '#my_modal' ).on( 'show.bs.modal' ,function(e){  
		cleanData('myForm2');
	});
  });
	

function cleanData(id){
	$(':input','#'+id)  
	 .not(':button, :submit, :reset, :hidden')  
	 .val('')  
	 //.removeAttr('checked')  
	 .removeAttr('selected');
	
	$('#'+id).find(".clean").val("");//按照样式清空；
}
//关闭win
function cannel(type){
	if(strUtil.isNull(type)){
		$('#my_modal').modal('hide');
	}else{
		$('#my_modal_'+type).modal('hide');
	}
}
var clickMenu= 'funds-user-list';
function getTableData(){
	deleteAllRow('example');
	$.ajax({
		   type:'get',
		   url: common_list_url,//user_search_url,
		   data:$('#searchFrom').serialize()+getCurrentPage(common_list_url+"?"+$('#searchFrom').serialize(),10),
		   dataType:'json',
		   success: function(myData){
			var data = baidu.template('dataList',eval(myData));  
			$("#myList").html(data);
			  var option= {
					   ele:$("#pageList")[0],
					   total:myData.total,
					   fn:getTableData,
					   url:common_list_url+"?"+$('#searchFrom').serialize()
				   }
			generatePages(option);
		   }
		});	
  }
function openViewWin(userName,realName){
  $("#fundsUserName").text(userName);
  $("#customerNo").val(userName);
  $("#settleAccountNo").val(userName);
  $("#fundsRealName").text(realName);
  var index_load = layer.load(1, {shade: false});
	$.ajax({
		type:'get',dataType:'json',
		url: common_list_url+'?doCode=F004&settleAccountNo='+userName,
		async: false,data: {f:new Date().getTime()},
		success:function(result)	{
			console.log(result);
			layer.close(index_load);
			var flag = result.flag;
			if("T"==flag){
				var obj = result.msg;
				$("#fundsAmtTotal").text(fmoney(obj.amtTotal*1/100));
				$("#fundsM1").text(fmoney(obj.m1*1/100));
				$("#fundsM2").text(fmoney(obj.m2*1/100));
				$('#my_modal').modal('show');
			}
		}
	}); 
}
function checkSubmitInfo(){
	var amount = $("#amount").val().trim();
	if(amount<=0){
		layer.tips('请输入大于零的金额！', '#amount', {tips: 1});
		$("#amount").val("");
		return;
	}
	var direction = $("input[name='direction']:checked").val();
	var m1 = $("#fundsM1").text().trim();
	if("out"==direction&&amount*1>m1){
		layer.tips('您输入的金额大于有效金额，请重新输入！', '#amount', {tips: 1});
		$("#amount").val("");
		return;
	}
	submitFunds();
}

</script>
</section>
    <!-- Main end -->
	</div>
  <!-- foot start -->
  <%@include file="/common/sale/foot.jsp" %>
  <!-- foot start -->
  
</body>

</html>
